<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <title>会议主页设置</title>
    <?php require 'templates/common/head.html'; ?>
    <style>
       /* .imgindex{margin-top:-100px;margin-left:-60px;margin-right:60px;}*/
    </style>
</head>

<body>
<!-- 配置文件 -->
<script type="text/javascript" src="../business/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="../business/ueditor/ueditor.all.min.js"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
    var ue = UE.getEditor('container', {
        toolbars: [
            [ 'fullscreen', 'source', '|', 'undo', 'redo', '|',
                'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',
                'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
                'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
                'directionalityltr', 'directionalityrtl', 'indent', '|',
                'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|','link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', '|',
                'simpleupload', 'insertimage', 'emotion', 'scrawl', 'attachment', 'map', 'gmap', 'insertframe']
        ],
        autoHeightEnabled: true,
        autoFloatEnabled: true
    });
</script>
<div class="container-fluid">
    <?php require 'templates/common/nav.html'; ?>
    <div class="panel panel-primary">
        <div class="panel-heading text-center">
            <h3 class="panel-title">会议子栏目设置</h3>
        </div>
        <div class="panel-body" style="font-size: 18px;">
            <a href="<?=$ico_edit_url?>&id=<?=$_GET['id']?>" type="button" class="btn btn-primary">添加ico</a>
            <input type="button" onclick="show_ico()" class="btn btn-primary" value="显示全部ico">
            <div id="ico_list">

            </div>
        </div>
            <div style="padding: 30px 30px 10px;">
                <form action="" method="post" enctype="multipart/form-data" class="bs-example bs-example-form" role="form">

                    <?php if($c_list): ?>

                    <!--<input type="button" class="con2" value="内容">-->
                    <input type="hidden" name="id[]" value="<?=$c_list->data['id']?>" />
                    <input  type="file" style="display: none"  class="img_file1" name="pic[]">
                    <img width="60" height="60" src="<?=G_SITE_BASE?>/<?=@$c_list->data['ico']?>" class="imgindex"/>
                    <input type="text" name="title[]" value="<?=$c_list->data['title']?>"/>

                    <select name="type[]">
                        <?php foreach($type as $k =>$v):?>
                                <option <?php if($v==$c_list->data['type']):?> selected ="selected" <?php endif; ?>  value="<?=$v?>"><?=$v?></option>
                        <?php endforeach;?>
                    </select>

                    <?php else:?>
                    <?php foreach($colunm as $k=>$v):?>
                        <div class="input-group">
                            <input type="hidden" name="title[]" value="<?=$v?>" />
                            <span class="input-group-addon"><?=$v?></span>
                            <div class="form-control">
                                <input  type="file"  class="img_file" name="pic[]">
                                <select name="type[]">
                                    <?php foreach($type as $k =>$v):?>
                                        <option value="<?=$v?>"><?=$v?></option>
                                    <?php endforeach;?>
                                </select>
                                <input  type="button"  class="btn_zi" name="" value="添加文字">
                                <input type="hidden" id="con" class="contain" name="big_content[]">
                            </div>
                        </div>
                        <br>
                    <?php endforeach;?>
                    <?php endif;?>
                    <div class="content_ude" <?php if(!isset($_GET['id'])):?>  style="display: none;"<?php endif;?> >
                         <script id="container" name="content[]" type="text/plain"><?=$c_list->data['content']?></script>
                    </div>

                    <div class="input-group" style="position:relative;top:0;left:50%;margin-left:-27px;margin-top:50px;">
                        <input type="submit" id="ee" class="form-control btn btn-primary" value="提交">
                    </div>

                </form>
            </div>

    </div>
</div>
<?php require 'templates/common/foot.html'; ?>
</body>
</html>
<script src="../business/resource/js/jquery-1.11.1.min.js"></script>
<script language="JavaScript">
    function show_ico(){
        var  str = "";
     $.post("<?=$ajax_ico_list?>",{'type':'','method':'ajax'},function(data){
         var data = eval('('+data+')');
         for(var i=0;i<data.length;i++){
             var a= data[i]['ico1'];
                     str += "<input type='checkbox'> <img width='60' height='60' src='" +data[i].ico1+ "'/>";

         }
         $("#ico_list").append(str);
     })
    }

    window.onload=function(){
        $(".imgindex").click(function(){
                var img_index= $(".imgindex").index(this);
                $(".img_file1").eq(img_index).click();
            })
        $(".con2").click(function(){
            $(".content_ude").show();

        })



    }
    $(function(){
       $(".btn_zi").on("click",function(){

            //通过判断按钮btn有没有active这个class名判断是否已经点击过
            if($(this).hasClass("active")){
                //如果有了active，假设已经点击过了
                //执行代码
                var btn_index= $(".btn_zi").index(this);
                //显示编辑器
                $(".content_ude").hide();
                //获取编辑器的内容：container：id
                var a= UE.getEditor('container').getAllHtml();
                //将编辑器的值存进input class=contain,此处用class 索引，用id 会出现未定义
                $(".contain").eq(btn_index).val(a);
                //把active去掉
                $(this).attr('value','添加文字');
               $(this).removeClass("active");
                UE.getEditor('container').setContent("");
            }else{
                //没有active，假设还没有点击过
                //执行代码,显示文本编辑器
                $(".content_ude").show();
                $(this).attr('value','保存');
                $(this).addClass("active");


            }
        })

    })



</script>